<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <title>ctzrqf.f</title>
 <meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!-- 
body { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default   { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default a { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.string   { color: rgb(188, 143, 143);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.string a { color: rgb(188, 143, 143);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.comment   { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.comment a { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
 --></style>

 </head>
  <body>

<pre>
      SUBROUTINE <a name="CTZRQF.1"></a><a href="ctzrqf.f.html#CTZRQF.1">CTZRQF</a>( M, N, A, LDA, TAU, INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  -- LAPACK routine (version 3.1) --
</span><span class="comment">*</span><span class="comment">     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
</span><span class="comment">*</span><span class="comment">     November 2006
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     .. Scalar Arguments ..
</span>      INTEGER            INFO, LDA, M, N
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Array Arguments ..
</span>      COMPLEX            A( LDA, * ), TAU( * )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Purpose
</span><span class="comment">*</span><span class="comment">  =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  This routine is deprecated and has been replaced by routine <a name="CTZRZF.17"></a><a href="ctzrzf.f.html#CTZRZF.1">CTZRZF</a>.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  <a name="CTZRQF.19"></a><a href="ctzrqf.f.html#CTZRQF.1">CTZRQF</a> reduces the M-by-N ( M&lt;=N ) complex upper trapezoidal matrix A
</span><span class="comment">*</span><span class="comment">  to upper triangular form by means of unitary transformations.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  The upper trapezoidal matrix A is factored as
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     A = ( R  0 ) * Z,
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  where Z is an N-by-N unitary matrix and R is an M-by-M upper
</span><span class="comment">*</span><span class="comment">  triangular matrix.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Arguments
</span><span class="comment">*</span><span class="comment">  =========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  M       (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of rows of the matrix A.  M &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  N       (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of columns of the matrix A.  N &gt;= M.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  A       (input/output) COMPLEX array, dimension (LDA,N)
</span><span class="comment">*</span><span class="comment">          On entry, the leading M-by-N upper trapezoidal part of the
</span><span class="comment">*</span><span class="comment">          array A must contain the matrix to be factorized.
</span><span class="comment">*</span><span class="comment">          On exit, the leading M-by-M upper triangular part of A
</span><span class="comment">*</span><span class="comment">          contains the upper triangular matrix R, and elements M+1 to
</span><span class="comment">*</span><span class="comment">          N of the first M rows of A, with the array TAU, represent the
</span><span class="comment">*</span><span class="comment">          unitary matrix Z as a product of M elementary reflectors.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDA     (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The leading dimension of the array A.  LDA &gt;= max(1,M).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  TAU     (output) COMPLEX array, dimension (M)
</span><span class="comment">*</span><span class="comment">          The scalar factors of the elementary reflectors.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  INFO    (output) INTEGER
</span><span class="comment">*</span><span class="comment">          = 0: successful exit
</span><span class="comment">*</span><span class="comment">          &lt; 0: if INFO = -i, the i-th argument had an illegal value
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Further Details
</span><span class="comment">*</span><span class="comment">  ===============
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  The  factorization is obtained by Householder's method.  The kth
</span><span class="comment">*</span><span class="comment">  transformation matrix, Z( k ), whose conjugate transpose is used to
</span><span class="comment">*</span><span class="comment">  introduce zeros into the (m - k + 1)th row of A, is given in the form
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Z( k ) = ( I     0   ),
</span><span class="comment">*</span><span class="comment">              ( 0  T( k ) )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  where
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     T( k ) = I - tau*u( k )*u( k )',   u( k ) = (   1    ),
</span><span class="comment">*</span><span class="comment">                                                 (   0    )
</span><span class="comment">*</span><span class="comment">                                                 ( z( k ) )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  tau is a scalar and z( k ) is an ( n - m ) element vector.
</span><span class="comment">*</span><span class="comment">  tau and z( k ) are chosen to annihilate the elements of the kth row
</span><span class="comment">*</span><span class="comment">  of X.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  The scalar tau is returned in the kth element of TAU and the vector
</span><span class="comment">*</span><span class="comment">  u( k ) in the kth row of A, such that the elements of z( k ) are
</span><span class="comment">*</span><span class="comment">  in  a( k, m + 1 ), ..., a( k, n ). The elements of R are returned in
</span><span class="comment">*</span><span class="comment">  the upper triangular part of A.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Z is given by
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Z =  Z( 1 ) * Z( 2 ) * ... * Z( m ).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> =====================================================================
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     .. Parameters ..
</span>      COMPLEX            CONE, CZERO
      PARAMETER          ( CONE = ( 1.0E+0, 0.0E+0 ),
     $                   CZERO = ( 0.0E+0, 0.0E+0 ) )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Scalars ..
</span>      INTEGER            I, K, M1
      COMPLEX            ALPHA
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Intrinsic Functions ..
</span>      INTRINSIC          CONJG, MAX, MIN
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Subroutines ..
</span>      EXTERNAL           CAXPY, CCOPY, CGEMV, CGERC, <a name="CLACGV.100"></a><a href="clacgv.f.html#CLACGV.1">CLACGV</a>, <a name="CLARFG.100"></a><a href="clarfg.f.html#CLARFG.1">CLARFG</a>,
     $                   <a name="XERBLA.101"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Executable Statements ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Test the input parameters.
</span><span class="comment">*</span><span class="comment">
</span>      INFO = 0
      IF( M.LT.0 ) THEN
         INFO = -1
      ELSE IF( N.LT.M ) THEN
         INFO = -2
      ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
         INFO = -4
      END IF
      IF( INFO.NE.0 ) THEN
         CALL <a name="XERBLA.116"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="CTZRQF.116"></a><a href="ctzrqf.f.html#CTZRQF.1">CTZRQF</a>'</span>, -INFO )
         RETURN
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Perform the factorization.
</span><span class="comment">*</span><span class="comment">
</span>      IF( M.EQ.0 )
     $   RETURN
      IF( M.EQ.N ) THEN
         DO 10 I = 1, N
            TAU( I ) = CZERO
   10    CONTINUE
      ELSE
         M1 = MIN( M+1, N )
         DO 20 K = M, 1, -1
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Use a Householder reflection to zero the kth row of A.
</span><span class="comment">*</span><span class="comment">           First set up the reflection.
</span><span class="comment">*</span><span class="comment">
</span>            A( K, K ) = CONJG( A( K, K ) )
            CALL <a name="CLACGV.136"></a><a href="clacgv.f.html#CLACGV.1">CLACGV</a>( N-M, A( K, M1 ), LDA )
            ALPHA = A( K, K )
            CALL <a name="CLARFG.138"></a><a href="clarfg.f.html#CLARFG.1">CLARFG</a>( N-M+1, ALPHA, A( K, M1 ), LDA, TAU( K ) )
            A( K, K ) = ALPHA
            TAU( K ) = CONJG( TAU( K ) )
<span class="comment">*</span><span class="comment">
</span>            IF( TAU( K ).NE.CZERO .AND. K.GT.1 ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              We now perform the operation  A := A*P( k )'.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Use the first ( k - 1 ) elements of TAU to store  a( k ),
</span><span class="comment">*</span><span class="comment">              where  a( k ) consists of the first ( k - 1 ) elements of
</span><span class="comment">*</span><span class="comment">              the  kth column  of  A.  Also  let  B  denote  the  first
</span><span class="comment">*</span><span class="comment">              ( k - 1 ) rows of the last ( n - m ) columns of A.
</span><span class="comment">*</span><span class="comment">
</span>               CALL CCOPY( K-1, A( 1, K ), 1, TAU, 1 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Form   w = a( k ) + B*z( k )  in TAU.
</span><span class="comment">*</span><span class="comment">
</span>               CALL CGEMV( <span class="string">'No transpose'</span>, K-1, N-M, CONE, A( 1, M1 ),
     $                     LDA, A( K, M1 ), LDA, CONE, TAU, 1 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              Now form  a( k ) := a( k ) - conjg(tau)*w
</span><span class="comment">*</span><span class="comment">              and       B      := B      - conjg(tau)*w*z( k )'.
</span><span class="comment">*</span><span class="comment">
</span>               CALL CAXPY( K-1, -CONJG( TAU( K ) ), TAU, 1, A( 1, K ),
     $                     1 )
               CALL CGERC( K-1, N-M, -CONJG( TAU( K ) ), TAU, 1,
     $                     A( K, M1 ), LDA, A( 1, M1 ), LDA )
            END IF
   20    CONTINUE
      END IF
<span class="comment">*</span><span class="comment">
</span>      RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     End of <a name="CTZRQF.171"></a><a href="ctzrqf.f.html#CTZRQF.1">CTZRQF</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>
